package com.lgj.servlets;

import com.lgj.domain.Student;
import com.lgj.service.StudentService;
import com.lgj.service.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;

public class Demo05Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("demo05");
        StudentService studentService = new StudentServiceImpl();
        ArrayList<Student> students = studentService.findAll();
        req.getSession().setAttribute("students",students);

    }
}
